package ae.pcfc.cldos.online.web.controller.generic;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import ae.pcfc.cldos.online.common.delegate.CompanyAdminDelegate;
import ae.pcfc.cldos.online.web.controller.base.BaseController;

@Controller
public class CancelProcessAjaxController extends BaseController {

	@Autowired
	@Qualifier("companyAdminDelegate")
	private CompanyAdminDelegate companyAdminDelegate;
	
	@RequestMapping(value = "/cancelProcess/{appId}", method=RequestMethod.POST)
	public @ResponseBody String markNotificationAsReaded(@PathVariable String appId, HttpServletResponse response){
		try {
			companyAdminDelegate.cancelProcess(encryptionDelegate.decodeAndDecrypt(appId), getUserVO());
		} catch (Exception e) {
			e.printStackTrace();
			response.setStatus(500);
		}
		return "Ok";
	}
}
